package br.com.base.business.impl.util;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.text.DecimalFormat;

public class Util {

	public static String converterDoubleToStringFormat(Double valor){
		try{
			DecimalFormat formatter = new DecimalFormat("###,###,###.#####");
			return formatter.format(valor);
		}catch(Exception e){}
		return null;
	}

	public static String md5(String valor){
		String md5 = null;
		try{
			MessageDigest m = MessageDigest.getInstance("MD5");
			m.update(valor.getBytes(), 0, valor.length());
			md5 = new BigInteger(1, m.digest()).toString(16);
			if(md5.length() < 32){
				md5 = "0" + md5;
			}
		}catch(Exception e){}
		return md5;
	}

}
